<template>
	<view class="myCollaboration" style="background-color: #EDEDED;">
		<navbar></navbar>
		<view class="myCollaboration-tab">
			<tui-icon name="arrowleft" :size="25" color="black" @click="leftHandler"></tui-icon>
			<view class="myCollaboration-tab-center">
				<tui-tabs :tabs="tabs"
					:currentTab="currentTab" 
					@change="change" 
					width="180"
					bold="true"
					selectedColor="black"
					sliderWidth="50"
					sliderBgColor="black"
					backgroundColor="#EBEDF0"
				>
				</tui-tabs>
			</view>
			<view style="display: flex; align-items: center; margin-right: 10rpx;"><van-button @click="faqi" icon="add-o" type="info" size="mini" round>发起</van-button></view>
		</view>
		<view class="myCollaboration-tab-tabitem" v-show="currentTab == 0">
			<view class="myCollaboration-tab-tabitem-vw">
				<view>
					<tui-tabs :tabs="list1"
						:currentTab="current1" 
						bold="true"
						selectedColor="black"
						sliderWidth="50"
						sliderBgColor="black"
						backgroundColor="#EBEDF0"
						@change="changeout"
					>
					</tui-tabs>
				</view>
				<view v-show="current1 == 0">
					<view class="answerRob-container-three" v-for="i in faList" :key="i.id">
						<view class="answerRob-container-three-top" v-if="i.status !== 100" @click="xzxq(i.id)">
							<text class="tx1">{{i.content}}</text>
							<text class="tx2">状态: {{i.statusname}}</text>
							<text class="tx3">价格：{{i.price}}￥</text>
						</view>
						<view class="answerRob-container-fore-top" v-if="i.status == 100">
							<text class="tx1">{{i.content}}</text>
							<text class="tx2">状态: {{i.statusname}}</text>
							<text class="tx3">价格：{{i.price}}￥</text>
						</view>
					</view>
					<view class="myCollaboration-tab-tabitem-child" v-if="faList.length == 0">
						<view class="answerRob-container-two-view">
							<image src="../../../static/暂无内容.png" mode=""></image>
							<text>未找到相关信息</text>
						</view>
					</view>
				</view>
				<view v-show="current1 == 1">
					<view class="answerRob-container-three" v-for="i in faList" :key="i.id">
						<view class="answerRob-container-three-top">
							<text class="tx1">{{i.content}}</text>
							<text class="tx2">状态: {{i.statusname}}</text>
							<text class="tx3">价格：{{i.price}}￥</text>
						</view>
					</view>
					<view class="myCollaboration-tab-tabitem-child" v-if="faList.length == 0">
						<view class="answerRob-container-two-view">
							<image src="../../../static/暂无内容.png" mode=""></image>
							<text>未找到相关信息</text>
						</view>
					</view>
				</view>
				<view v-show="current1 == 2">
					<view class="answerRob-container-three" v-for="i in faList" :key="i.id">
						<view class="answerRob-container-three-top">
							<text class="tx1">{{i.content}}</text>
							<text class="tx2">状态: {{i.statusname}}</text>
							<text class="tx3">价格：{{i.price}}￥</text>
						</view>
					</view>
					<view class="myCollaboration-tab-tabitem-child" v-if="faList.length == 0">
						<view class="answerRob-container-two-view">
							<image src="../../../static/暂无内容.png" mode=""></image>
							<text>未找到相关信息</text>
						</view>
					</view>
				</view>
				<view v-show="current1 == 3">
					<view class="answerRob-container-three" v-for="i in faList" :key="i.id">
						<view class="answerRob-container-three-top">
							<text class="tx1">{{i.content}}</text>
							<text class="tx2">状态: {{i.statusname}}</text>
							<text class="tx3">价格：{{i.price}}￥</text>
						</view>
					</view>
					<view class="myCollaboration-tab-tabitem-child" v-if="faList.length == 0">
						<view class="answerRob-container-two-view">
							<image src="../../../static/暂无内容.png" mode=""></image>
							<text>未找到相关信息</text>
						</view>
					</view>
				</view>
				<view v-show="current1 == 4">
					<view class="answerRob-container-three" v-for="i in faList" :key="i.id">
						<view class="answerRob-container-three-top">
							<text class="tx1">{{i.content}}</text>
							<text class="tx2">状态: {{i.statusname}}</text>
							<text class="tx3">价格：{{i.price}}￥</text>
						</view>
					</view>
					<view class="myCollaboration-tab-tabitem-child" v-if="faList.length == 0">
						<view class="answerRob-container-two-view">
							<image src="../../../static/暂无内容.png" mode=""></image>
							<text>未找到相关信息</text>
						</view>
					</view>
				</view>
				<view v-show="current1 == 5">
					<view class="answerRob-container-three" v-for="i in faList" :key="i.id">
						<view class="answerRob-container-three-top">
							<text class="tx1">{{i.content}}</text>
							<text class="tx2">状态: {{i.statusname}}</text>
							<text class="tx3">价格：{{i.price}}￥</text>
						</view>
					</view>
					<view class="myCollaboration-tab-tabitem-child" v-if="faList.length == 0">
						<view class="answerRob-container-two-view">
							<image src="../../../static/暂无内容.png" mode=""></image>
							<text>未找到相关信息</text>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="myCollaboration-tab-tabitem" v-show="currentTab == 1">
			<view class="myCollaboration-tab-tabitem-vw">
				<view>
					<tui-tabs :tabs="list2"
						:currentTab="current2" 
						bold="true"
						selectedColor="black"
						sliderWidth="50"
						sliderBgColor="black"
						backgroundColor="#EBEDF0"
						@change="changeouts"
					>
					</tui-tabs>
				</view>
				<view v-show="current2 == 0">
					<view class="answerRob-container-three" v-for="i in jieList" :key="i.id" @click="xzxq(i.id)">
						<view class="answerRob-container-three-top">
							<text class="tx1">{{i.content}}</text>
							<text class="tx2">状态: {{i.statusname}}</text>
							<text class="tx3">价格：{{i.price}}￥</text>
						</view>
					</view>
					<view class="myCollaboration-tab-tabitem-child" v-if="jieList.length == 0">
						<view class="answerRob-container-two-view">
							<image src="../../../static/暂无内容.png" mode=""></image>
							<text>未找到相关信息</text>
						</view>
					</view>
				</view>
				<view v-show="current2 == 1">
					<view class="answerRob-container-three" v-for="i in jieList" :key="i.id" @click="xzxq(i.id)">
						<view class="answerRob-container-three-top">
							<text class="tx1">{{i.content}}</text>
							<text class="tx2">状态: {{i.statusname}}</text>
							<text class="tx3">价格：{{i.price}}￥</text>
						</view>
					</view>
					<view class="myCollaboration-tab-tabitem-child" v-if="jieList.length == 0">
						<view class="answerRob-container-two-view">
							<image src="../../../static/暂无内容.png" mode=""></image>
							<text>未找到相关信息</text>
						</view>
					</view>
				</view>
				<view v-show="current2 == 2">
					<view class="answerRob-container-three" v-for="i in jieList" :key="i.id" @click="xzxq(i.id)">
						<view class="answerRob-container-three-top">
							<text class="tx1">{{i.content}}</text>
							<text class="tx2">状态: {{i.statusname}}</text>
							<text class="tx3">价格：{{i.price}}￥</text>
						</view>
					</view>
					<view class="myCollaboration-tab-tabitem-child" v-if="jieList.length == 0">
						<view class="answerRob-container-two-view">
							<image src="../../../static/暂无内容.png" mode=""></image>
							<text>未找到相关信息</text>
						</view>
					</view>
				</view>
				<view v-show="current2 == 3">
					<view class="answerRob-container-three" v-for="i in jieList" :key="i.id" @click="xzxq(i.id)">
						<view class="answerRob-container-three-top">
							<text class="tx1">{{i.content}}</text>
							<text class="tx2">状态: {{i.statusname}}</text>
							<text class="tx3">价格：{{i.price}}￥</text>
						</view>
					</view>
					<view class="myCollaboration-tab-tabitem-child" v-if="jieList.length == 0">
						<view class="answerRob-container-two-view">
							<image src="../../../static/暂无内容.png" mode=""></image>
							<text>未找到相关信息</text>
						</view>
					</view>
				</view>
				<view v-show="current2 == 4">
					<view class="answerRob-container-three" v-for="i in jieList" :key="i.id" @click="xzxq(i.id)">
						<view class="answerRob-container-three-top">
							<text class="tx1">{{i.content}}</text>
							<text class="tx2">状态: {{i.statusname}}</text>
							<text class="tx3">价格：{{i.price}}￥</text>
						</view>
					</view>
					<view class="myCollaboration-tab-tabitem-child" v-if="jieList.length == 0">
						<view class="answerRob-container-two-view">
							<image src="../../../static/暂无内容.png" mode=""></image>
							<text>未找到相关信息</text>
						</view>
					</view>
				</view>
				<view v-show="current2 == 5">
					<view class="answerRob-container-three" v-for="i in jieList" :key="i.id" @click="xzxq(i.id)">
						<view class="answerRob-container-three-top">
							<text class="tx1">{{i.content}}</text>
							<text class="tx2">状态: {{i.statusname}}</text>
							<text class="tx3">价格：{{i.price}}￥</text>
						</view>
					</view>
					<view class="myCollaboration-tab-tabitem-child" v-if="jieList.length == 0">
						<view class="answerRob-container-two-view">
							<image src="../../../static/暂无内容.png" mode=""></image>
							<text>未找到相关信息</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import tuiTabs from "@/components/thorui/tui-tabs/tui-tabs.vue"
	import tuiIcon from "@/components/thorui/tui-icon/tui-icon.vue"
	import { mycoop, taking_coop } from "../../../utils/utils"
	export default {
		components:{
			tuiTabs,
			tuiIcon
		},
		data() {
			return {
				currentTab: 0, // 发单个接单的标签页
				current1: 0, // 我的发单内标签页
				current2: 0, // 我的接单内标签页
				page: '1', // 发单页数
				pages: '1', // 接单页数
				tabs: [{ // 标签页
					name: "我的发单"
					}, {
						name: "我的接单"
					},
				],
				list1: [{ // 我的发单的标签页
						name: "全部"
					}, {
						name: "应征中"
					}, {
						name: "协作中"
					}, {
						name: "待确认"
					}, {
						name: "已完成"
					}, {
						name: "已失效"
					},
				],
				list2: [{ // 我的接单的标签页
						name: "全部"
					}, {
						name: "应征中"
					}, {
						name: "协作中"
					}, {
						name: "待确认"
					}, {
						name: "已完成"
					}, {
						name: "已失效"
					},
				],
				status: 'all', // 类型
				faList: [], // 发单的数组
				jieList: [], // 接单的数组
			}
		},
		onLoad() {
			let a = {
				page: this.page,
				status: this.status
			}
			// 我的发单
			mycoop(a, (e) => {
				console.log('我的发单', e);
				this.faList = [...e.data.data.data]
			})
			let b = {
				page: this.pages,
				status: this.status
			}
			// 我的接单
			taking_coop(b, (i) => {
				console.log('我的接单', i);
				this.jieList = [...i.data.data.data]
			})
		},
		methods: {
			// 发单接单标签页切换
			change(e) {
				this.currentTab = e.index
				console.log(this.currentTab);
			},
			// 发单内标签页切换
			changeout(e) {
				this.current1 = e.index
				switch(this.current1) {
					case 0: {
						this.status = 'all'
						let a = {
							page: this.page,
							status: this.status
						}
						mycoop(a, (e) => {
							this.faList = [...e.data.data.data]
						})
						break;
					}
					case 1: {
						this.status = '0'
						let a = {
							page: this.page,
							status: this.status
						}
						mycoop(a, (e) => {
							this.faList = [...e.data.data.data]
						})
						break;
					}
					case 2: {
						this.status = '1'
						let a = {
							page: this.page,
							status: this.status
						}
						mycoop(a, (e) => {
							this.faList = [...e.data.data.data]
						})
						break;
					}
					case 3: {
						this.status = '2'
						let a = {
							page: this.page,
							status: this.status
						}
						mycoop(a, (e) => {
							this.faList = [...e.data.data.data]
						})
						break;
					}
					case 4: {
						this.status = '3'
						let a = {
							page: this.page,
							status: this.status
						}
						mycoop(a, (e) => {
							this.faList = [...e.data.data.data]
						})
						break;
					}
					case 5: {
						this.status = '100'
						let a = {
							page: this.page,
							status: this.status
						}
						mycoop(a, (e) => {
							this.faList = [...e.data.data.data]
						})
						break;
					}
				}
			},
			// 接单内标签页切换
			changeouts(e) {
				this.current2 = e.index
				switch(this.current2) {
					case 0: {
						this.status = 'all'
						let a = {
							page: this.page,
							status: this.status
						}
						taking_coop(a, (e) => {
							this.jieList = [...e.data.data.data]
						})
						break;
					}
					case 1: {
						this.status = '0'
						let a = {
							page: this.page,
							status: this.status
						}
						taking_coop(a, (e) => {
							this.jieList = [...e.data.data.data]
						})
						break;
					}
					case 2: {
						this.status = '1'
						let a = {
							page: this.page,
							status: this.status
						}
						taking_coop(a, (e) => {
							this.jieList = [...e.data.data.data]
						})
						break;
					}
					case 3: {
						this.status = '2'
						let a = {
							page: this.page,
							status: this.status
						}
						taking_coop(a, (e) => {
							this.jieList = [...e.data.data.data]
						})
						break;
					}
					case 4: {
						this.status = '3'
						let a = {
							page: this.page,
							status: this.status
						}
						taking_coop(a, (e) => {
							this.jieList = [...e.data.data.data]
						})
						break;
					}
					case 5: {
						this.status = '100'
						let a = {
							page: this.page,
							status: this.status
						}
						taking_coop(a, (e) => {
							this.jieList = [...e.data.data.data]
						})
						break;
					}
				}
			},
			// 跳转到发起页面
			faqi () {
				uni.navigateTo({
					url: "/pages/Attorney side/lawyerCollaboration/lawyerCollaboration"
				})
			},
			// 返回
			leftHandler () {
				uni.navigateBack(-1)
			},
			// 点击跳转到详情页
			xzxq (i) {
				uni.navigateTo({
					url: `/pages/Attorney side/xzxqPage/xzxqPage?id=${i}&name=fa`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.myCollaboration {
		height: 100vh;
		background-color: #EDEDED;
	}
	.myCollaboration-tab {
		width: 95%;
		margin: 0 auto;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	.myCollaboration-tab-center {
		margin-left: 60rpx;
	}
	
	.myCollaboration-tab-tabitem-child {
		width: 100%;
		height: 1200rpx;
	}
	
	.answerRob-container-two-view {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		margin-top: 120rpx;
		font-size: 24rpx;
		color: #666666;
	}
	.answerRob-container-two-view > image {
		width: 400rpx;
		height: 240rpx;
	}
	

	.answerRob-container-three {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
	.answerRob-container-three-top {
		display: flex;
		flex-direction: column;
		justify-content: space-around;
		align-items: center;
		background-color: white;
		width: 95%;
		height: 200rpx;
		margin-bottom: 20rpx;
		border-radius: 24rpx;
	}
	.answerRob-container-three-top > .tx1 {
		font-weight: bold;
		width: 94%;
		display: -webkit-box;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;  
		overflow: hidden;
	}
	.answerRob-container-three-top > .tx2 {
		font-size: 24rpx;
		width: 94%;
		color: #C0C0C0;
	}
	.answerRob-container-three-top > .tx3 {
		font-size: 28rpx;
		width: 94%;
	}
	
	
	.answerRob-container-fore-top {
		display: flex;
		flex-direction: column;
		justify-content: space-around;
		align-items: center;
		background-color: #8e8f91;
		width: 95%;
		height: 200rpx;
		margin-bottom: 20rpx;
		border-radius: 24rpx;
	}
	.answerRob-container-fore-top > .tx1 {
		font-weight: bold;
		width: 94%;
		display: -webkit-box;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;  
		overflow: hidden;
	}
	.answerRob-container-fore-top > .tx2 {
		font-size: 24rpx;
		width: 94%;
		color: #C0C0C0;
	}
	.answerRob-container-fore-top > .tx3 {
		font-size: 28rpx;
		width: 94%;
	}
</style>
